package zkk.com.mengqu.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import zkk.com.mengqu.R;
import zkk.com.mengqu.activity.KitchenOrderActivity;

/**
 * 厨房共享页面适配器
 */
public class KitchenShareAdapter extends BaseAdapter {

    private static final int TYPE_DATE = 0;//带日期
    private static final int TYPE_NOTDATE = 1;//不带日期

    private Context context;
    public KitchenShareAdapter(Context con) {
        this.context=con;
    }

    @Override
    public int getCount() {
//        return infoItemBeens==null?0:infoItemBeens.size();
        return 5;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

//        final InfoItemBean infoItemBean = infoItemBeens.get(position);
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_kitchen_share,null);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }

        holder.kitchenShare = (LinearLayout)convertView.findViewById(R.id.ll_kitchen_share);
        holder.kitchenShare.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context , KitchenOrderActivity.class));
            }
        });

        holder.order = (TextView) convertView.findViewById(R.id.tx_kitchen_order);
        holder.order.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context , "第" + position + "个预约" , Toast.LENGTH_LONG).show();
            }
        });
        return convertView;
    }

    class ViewHolder{
        private LinearLayout kitchenShare;
        private TextView order;

    }
}
